home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1991-12-27 | 55.2 KB | 1,900 lines
Newsgroups: comp.sources.misc From: tcamp@hercules.acpub.duke.edu (Ted Campbell) Subject: v27i017: sfs - Space Flight Simulator, Part17/21 Message-ID: <1991Dec24.191854.21065@sparky.imd.sterling.com> X-Md4-Signature: 3c67e59812b5697b536f798a69fbca03 Date: Tue, 24 Dec 1991 19:18:54 GMT Approved: kent@sparky.imd.sterling.com Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell) Posting-number: Volume 27, Issue 17 Archive-name: sfs/part17 Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11, #!/bin/sh # do not concatenate these parts, unpack them in order with /bin/sh # file sfs/map/map.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 17; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping sfs/map/map.c' else echo 'x - continuing file sfs/map/map.c' sed 's/^X//' << 'SHAR_EOF' >> 'sfs/map/map.c' && X prevy, prevx, map_defalt ); X fprintf( outfile, "5\t%lf\t%lf\t%lf\n", X ypos, xpos, map_defalt ); X break; X default: X fprintf( outfile, "5\t%lf\t%lf\t%lf\n", X prevy, prevx, map_defalt ); X fprintf( outfile, "5\t%lf\t%lf\t%lf\n", X ypos, xpos, map_defalt ); X break; X } X X /* clear the quit and backup areas */ X X ui_fbox( qu_x1 - 1, qu_y1, bu_x2, bu_y2, X WHITE, SOLID ); X X } X /**************************************************************** X X map_entitle() X ****************************************************************/ X map_entitle() X { X static int image; X X if ( dial_x1 == 0 ) X { X midx = main_window->u_x1 X + ((main_window->u_x2 - main_window->u_x1 ) / 2 ); X midy = main_window->u_y1 X + ((main_window->u_y2 - main_window->u_y1 ) / 2 ); X length = ( main_window->u_x2 - main_window->u_x1 ) / 2; X dial_x1 = midx - length / 2; X dial_x2 = midx + length / 2; X height = ( main_window->u_y2 - main_window->u_y1 ) / 2; X dial_y1 = midy - height / 2; X dial_y2 = midy + height / 2; X X } X X gr_imsave( GR_PRIMARY, TRUE, dial_x1, dial_y1, X dial_x2, dial_y2, &image ); X ui_dial( dial_x1, dial_y1, dial_x2, dial_y2, X cl_mback, cl_mfore, cl_marker, X TRUE, ENT_TITLE, X ENT_TEXT, ENT_PROMPT, buffer, &dial_window ); X gr_imsave( GR_PRIMARY, FALSE, dial_x1, dial_y1, X dial_x2, dial_y2, &image ); X gr_imfree( image ); X X fprintf( outfile, ";----------------------------------------------------------------\n" ); X fprintf( outfile, ";\n" ); X fprintf( outfile, ";\t%s\n", buffer ); X fprintf( outfile, ";\n" ); X X } X /**************************************************************** X X map_altitude() X ****************************************************************/ X map_altitude() X { X static double n; X static int image; X X if ( dial_x1 == 0 ) X { X midx = main_window->u_x1 X + ((main_window->u_x2 - main_window->u_x1 ) / 2 ); X midy = main_window->u_y1 X + ((main_window->u_y2 - main_window->u_y1 ) / 2 ); X length = ( main_window->u_x2 - main_window->u_x1 ) / 2; X dial_x1 = midx - length / 2; X dial_x2 = midx + length / 2; X height = ( main_window->u_y2 - main_window->u_y1 ) / 2; X dial_y1 = midy - height / 2; X dial_y2 = midy + height / 2; X X } X X gr_imsave( GR_PRIMARY, TRUE, dial_x1, dial_y1, X dial_x2, dial_y2, &image ); X ui_dial( dial_x1, dial_y1, dial_x2, dial_y2, X cl_mback, cl_mfore, cl_marker, X TRUE, ALT_TITLE, X ALT_TEXT, ALT_PROMPT, buffer, &dial_window ); X gr_imsave( GR_PRIMARY, FALSE, dial_x1, dial_y1, X dial_x2, dial_y2, &image ); X gr_imfree( image ); X X sscanf( buffer, "%lf", &n ); X } X /**************************************************************** X X map_exit() X ****************************************************************/ X map_exit() X { X kb_deinit(); X gr_deinit(); X } X /**************************************************************** X X map_font() X ****************************************************************/ X map_font( size ) X int size; X { X static oldsize = 159; X int rq_height; X X if ( size == oldsize ) X { X return; X } X X switch( size ) X { X case 1: X rq_height = ui_grwind->ymax / 25; X break; X case 2: X rq_height = ui_grwind->ymax / 15; X break; X default: X rq_height = ui_grwind->ymax / 30; X break; X } X X gr_font( GR_PRIMARY, F_DEFAULT, rq_height ); X } X /**************************************************************** X X map_colors() X ****************************************************************/ X map_colors() X { X X if ( gr_colors > 8 ) X { X cl_mback = WHITE; X cl_mfore = BLACK; X cl_marker = DARK_CYAN; X cl_grid = DARK_BLUE; X cl_surface = DARK_GREEN; X } X else if ( gr_colors > 2 ) X { X cl_mback = WHITE; X cl_mfore = BLACK; X cl_marker = BLACK; X cl_grid = WHITE; X cl_surface = WHITE; X } X else X { X cl_mback = WHITE; X cl_mfore = BLACK; X cl_marker = WHITE; X cl_grid = WHITE; X cl_surface = WHITE; X } X X } X /**************************************************************** X X bw_error() X ****************************************************************/ X bw_error( mes ) X char *mes; X { X static char buffer[ BW_EBUFSIZE ]; X static int image; X static int x1 = 0, x2, y1, y2, height, length, midx, midy, c; X static struct uiwindow *err_window; X X if ( x1 == 0 ) X { X X midx = main_window->u_x1 + ( ( main_window->u_x2 - main_window->u_x1 ) / 2 ); X midy = main_window->u_y1 + ( ( main_window->u_y2 - main_window->u_y1 ) / 2 ); X X length = main_window->u_x2 / 2; X x1 = midx - length / 2; X x2 = midx + length / 2; X height = main_window->u_y2 / 2; X y1 = midy - height / 2; X y2 = midy + height / 2; X X } X X gr_imsave( GR_PRIMARY, TRUE, x1, y1, x2, y2, &image ); X buffer[ 0 ] = 0; X sprintf( buffer, ERR_PROMPT, mes ); X c = ui_yn( x1, y1, x2, y2, cl_mback, cl_mfore, cl_marker, TRUE, X buffer, ERRP_NO, ERRP_YES, &err_window ); X gr_imsave( GR_PRIMARY, FALSE, x1, y1, x2, y2, &image ); X gr_imfree( image ); X X if ( c == FALSE ) X { X map_exit(); X exit( 1 ); X } X } X /**************************************************************** X X bw_debug() X ****************************************************************/ X #ifdef DEBUG bw_debug( mes ) X char *mes; X { X static char buffer[ 256 ]; X X sprintf( buffer, "DEBUG: %s ", mes ); X bw_message( buffer ); X ui_wait(); X } #endif X /**************************************************************** X X map_sigint() X ****************************************************************/ X map_sigint() X { X kb_deinit(); X gr_deinit(); X exit( 1 ); X } X /**************************************************************** X X bw_message() X ****************************************************************/ X bw_message( m ) X char *m; X { X ui_fbox( main_window->u_x1, main_window->u_y1, X main_window->u_x2, mesg_y - 1, BLACK, SOLID ); X ui_str( 5, 5, main_window->x2, BLACK, WHITE, m ); X } X ui_poll() X { X } SHAR_EOF echo 'File sfs/map/map.c is complete' && chmod 0644 sfs/map/map.c || echo 'restore of sfs/map/map.c failed' Wc_c="`wc -c < 'sfs/map/map.c'`" test 25899 -eq "$Wc_c" || echo 'sfs/map/map.c: original size 25899, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/map/map.h ============== if test -f 'sfs/map/map.h' -a X"$1" != X"-c"; then echo 'x - skipping sfs/map/map.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/map/map.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map.h' && /*************************************************************** X X map.h Header file X for SFS Map utility X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ***************************************************************/ X X #define MAP_TITLE "SFS Map Utility, version %s" #define MAP_VERSION "1.01" #define MAP_DEFAULTDATA "test.spd" #define MAP_DRAW "Drawing Map..." #define MAP_HELP "Press ESC or Click in Top Bar" #define MAP_MM "Main Menu -- Select Item" #define MAP_SELECT "Use Arrow Keys to Select Position, then RETURN" #define MAP_SEQM "SEQUENCE: Click points -- click top bar to end" X #define MM_TITLE "Main Menu" #define MM_POSITION "Change Position" #define MM_ENTITLE "Enter Title or Comment" #define MM_SEQUENCE "Begin Sequence" #define MM_ALTITUDE "Set Default Altitude" #define MM_EXIT "Exit" X #define ALT_TITLE "Set Default Altitude" #define ALT_TEXT "Enter the altitude for subsequent sequence points in kilometers." #define ALT_PROMPT "Altitude: " #define ALT_MEMERR "Cannot allocate memory for dialogue box" X #define ENT_TITLE "Enter Title or Comment" #define ENT_TEXT "Enter a title or comment line." #define ENT_PROMPT "Title/Comment: " X #define SEQ_QUIT "QUIT" #define SEQ_BACKUP "BACKUP" X #define ERR_PROMPT "ERROR: %s; Do you want to continue? " #define ERRP_NO "N - ABORT" #define ERRP_YES "Y - Continue" #define ERR_MATH "Mathematics error, %s" #define ERR_MOUSE "You must have a pointer device to enter points" X #define MEMERR_ESC "Cannot allocate memory for ESCAPE menu" #define MEMERR_ERR "Cannot allocate memory for ERROR screen" #define MEMERR_SEQ "Cannot allocate memory for next point" X #define MM_TITLES 5 X extern int dr_xsize; /* Size of ground track map, x */ extern int dr_ysize; /* Size of ground track map, y */ extern int dr_mapbase; /* Bottom of gt map */ extern int dr_mapedge; /* Left edge of groundtrack map */ X /*** Colors */ X extern int cl_mback; /* Main background color */ extern int cl_mfore; /* Main foreground color */ extern int cl_marker; /* Color for prompt markers */ extern int cl_grid; /* Color for planetary grid */ extern int cl_surface; /* Color for planetary surface */ X extern int map_pos[ 10 ][ 4 ]; X SHAR_EOF chmod 0644 sfs/map/map.h || echo 'restore of sfs/map/map.h failed' Wc_c="`wc -c < 'sfs/map/map.h'`" test 3311 -eq "$Wc_c" || echo 'sfs/map/map.h: original size 3311, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/map/map.mak ============== if test -f 'sfs/map/map.mak' -a X"$1" != X"-c"; then echo 'x - skipping sfs/map/map.mak (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/map/map.mak (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map.mak' && PROJ =MAP DEBUG =0 CC =qcl CFLAGS_G = /AL /W1 /Ze /DDEBUG /I..\..\include CFLAGS_D = /Zi /Zr /Gi$(PROJ).mdt /Od CFLAGS_R = /O /Ot /DNDEBUG CFLAGS =$(CFLAGS_G) $(CFLAGS_R) LFLAGS_G =/NOI LFLAGS_D =/INCR /CO LFLAGS_R = LFLAGS =$(LFLAGS_G) $(LFLAGS_R) RUNFLAGS = OBJS_EXT = ..\..\lib\dr_ibmpc.obj ..\..\lib\gr_ibmpc.obj ..\..\lib\kb_ibmpc.obj \ X ..\..\lib\ui_boxes.obj ..\..\lib\ui_init.obj ..\..\lib\ui_text.obj ..\..\lib\ui_gets.obj \ X ..\..\lib\ui_dial.obj ..\..\lib\ui_list.obj ..\..\lib\ui_pbm.obj LIBS_EXT = X all: $(PROJ).exe X map.obj: map.c X as_vpt.obj: ..\as\as_vpt.c X as_orbit.obj: ..\as\as_orbit.c X as_spj.obj: ..\as\as_spj.c X map_dr.obj: map_dr.c X $(PROJ).exe: map.obj as_vpt.obj as_orbit.obj as_spj.obj map_dr.obj $(OBJS_EXT) X echo >NUL @<<$(PROJ).crf map.obj + as_vpt.obj + as_orbit.obj + as_spj.obj + map_dr.obj + $(OBJS_EXT) $(PROJ).exe X $(LIBS_EXT); << X link $(LFLAGS) @$(PROJ).crf X run: $(PROJ).exe X $(PROJ) $(RUNFLAGS) X SHAR_EOF chmod 0644 sfs/map/map.mak || echo 'restore of sfs/map/map.mak failed' Wc_c="`wc -c < 'sfs/map/map.mak'`" test 941 -eq "$Wc_c" || echo 'sfs/map/map.mak: original size 941, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/map/map_dr.c ============== if test -f 'sfs/map/map_dr.c' -a X"$1" != X"-c"; then echo 'x - skipping sfs/map/map_dr.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/map/map_dr.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map_dr.c' && /*************************************************************** X X map_dr.c Map drawing routines X for SFS Map utility X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ***************************************************************/ X #include "stdio.h" #include "ctype.h" #include "bw.h" #include "gr.h" #include "kb.h" #include "ui.h" #include "as.h" #include "map.h" X #ifdef __STDC__ #include "stdlib.h" #endif X /*************************************************************** X X dr_draw() X X This function draws the ground track screen. X It is called by fo_draw(). X ***************************************************************/ X dr_draw( uiwind, redraw_screen, s_start, s_end, pos ) X struct uiwindow *uiwind; X int redraw_screen, pos; X struct spj_pt *s_start, *s_end; X { X register int orbit; X int x, y; X #ifdef OLD_DEBUG X sprintf( bw_ebuf, "dr_draw(): %d %d %d %d", uiwind->u_x1, uiwind->u_y1, X uiwind->u_x2, uiwind->u_y2 ); X bw_debug( bw_ebuf ); #endif X X bw_message( MAP_DRAW ); X X if ( redraw_screen == TRUE ) X { X X /* Prepare the screen */ X X dr_prep( uiwind, pos ); X X /* Draw the surface features */ X X dr_plot( s_start, s_end, cl_surface, SOLID, pos ); X X } X X } X /*************************************************************** X X dr_prep() X X This routine draws the panel at the bottom of the screen X which contains various parameters and is used when the X ground track display is in effect. The routine is called X by dr_draw(). X ***************************************************************/ X dr_prep( uiwind, pos ) X struct uiwindow *uiwind; X int pos; X { X register int c; X int inc; X double x; X int x_xmax, x_ymax; X X /*** Blank the entire window user area */ X X ui_fbox( uiwind->u_x1, uiwind->u_y1, X uiwind->u_x2, uiwind->u_y2, BLACK, SOLID ); X X /*** First determine if x or y axis must be scaled */ X X x_xmax = uiwind->u_x2 - uiwind->u_x1; X x_ymax = uiwind->u_y2 - uiwind->u_y1; X X if ( ( x_xmax / 2 ) > X ( ( x_ymax * gr_pysize ) / gr_pxsize ) X ) X X { /* TRUE = scale x */ X #ifdef OLD_DEBUG X bw_debug( "Scaling x" ); #endif X X dr_ysize = x_ymax; X dr_xsize = 2 * (( dr_ysize * gr_pysize ) / gr_pxsize ); X X /*** Calculate dr_mapedge */ X X dr_mapedge = uiwind->u_x1 + X ( ( x_xmax - dr_xsize ) / 2 ); X X /*** Calculate dr_mapbase */ X X dr_mapbase = uiwind->u_y1; X X } X X else /* FALSE = scale y */ X { X #ifdef OLD_DEBUG X bw_debug( "Scaling y" ); #endif X X dr_xsize = x_xmax; X dr_ysize = (( dr_xsize * gr_pxsize ) / gr_pysize ) / 2; X X /*** Calculate dr_mapedge */ X X dr_mapedge = uiwind->u_x1; X X /*** Calculate dr_mapbase */ X X dr_mapbase = uiwind->u_y1 + X ( ( x_ymax - dr_ysize ) / 2 ); X X } X X /*** Draw lines demarcating the display within the window */ X X gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase, dr_mapedge, X dr_mapbase + dr_ysize, cl_grid, SOLID ); X X gr_line( GR_PRIMARY, dr_mapedge + dr_xsize, dr_mapbase, X dr_mapedge + dr_xsize, dr_mapbase + dr_ysize, X cl_grid, SOLID ); X X gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase, X dr_mapedge + dr_xsize, X dr_mapbase, cl_grid, SOLID ); X X gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase + dr_ysize, X dr_mapedge + dr_xsize, dr_mapbase + dr_ysize, X cl_grid, SOLID ); X #ifdef OLD_DEBUG X sprintf( bw_ebuf, "x_size %d, y_size %d, mapedge %d, mapbase %d", X dr_xsize, dr_ysize, dr_mapedge, dr_mapbase ); X bw_debug( bw_ebuf ); #endif X X /*** Now draw the latitude and longitude lines. We must draw X only a quarter of a line at a time, or dr_line will X reject the request. */ X X for ( x = -75.0; x < 90.0; x += 15.0 ) /* latitudes */ X { X dr_line( x, -180.0, x, -90.0, cl_grid, GRID, pos ); X dr_line( x, -90.0, x, 0.0, cl_grid, GRID, pos ); X dr_line( x, 0.0, x, 90.0, cl_grid, GRID, pos ); X dr_line( x, 90.0, x, 180.0, cl_grid, GRID, pos ); X } X X for ( x = -165.0; x < 180.0; x += 15.0 ) /* longitudes */ X { X dr_line( -90.0, x, -45.0, x, cl_grid, GRID, pos ); X dr_line( -45.0, x, 0.0, x, cl_grid, GRID, pos ); X dr_line( 0.0, x, 45.0, x, cl_grid, GRID, pos ); X dr_line( 45.0, x, 90.0, x, cl_grid, GRID, pos ); X } X #ifdef OLD_DEBUG X bw_debug( "end of dr_prep() " ); #endif X X } X /*************************************************************** X X dr_plot() X X This routine plots a set of coordinates on the ground X track map. It is called by dr_draw(). X ***************************************************************/ X dr_plot( start, end, color, style, pos ) X struct spj_pt *start, *end; X int color, style, pos; X { X struct spj_pt *current; X double prevx, prevy; X X current = start->next; X #ifdef OLD_DEBUG X bw_debug( "DEBUG: Plotting" ); #endif X X prevx = current->longitude; X prevy = current->latitude; X while ( current != end ) X { X if ( current->code < 1000 ) X { X dr_line( current->latitude, current->longitude, X prevy, prevx, color, style, pos ); X } X prevx = current->longitude; X prevy = current->latitude; X current = current->next; X } X #ifdef OLD_DEBUG X bw_message( " " ); #endif X } X /*************************************************************** X X dr_line() X X This routine draws a single line on the ground X track map. X ***************************************************************/ X dr_line( fromlat, fromlon, tolat, tolon, color, style, pos ) X double fromlat, fromlon, tolat, tolon; X int color, style, pos; X { X int x1, y1, x2, y2; X X if ( ( fromlat < map_pos[ pos ][ 1 ] ) || ( fromlat > map_pos[ pos ][ 3 ] )) X { X /* sprintf( bw_ebuf, "dr_line received from latitude %.2lf", fromlat ); X bw_error( bw_ebuf ); */ X return BW_ERROR; X } X if ( ( tolat < map_pos[ pos ][ 1 ] ) || ( tolat > map_pos[ pos ][ 3 ] )) X { X /* sprintf( bw_ebuf, "dr_line received to latitude %.2lf", tolat ); X bw_error( bw_ebuf ); */ X return BW_ERROR; X } X if ( ( fromlon < map_pos[ pos ][ 0 ] ) || ( fromlon > map_pos[ pos ][ 2 ] )) X { X /* sprintf( bw_ebuf, "dr_line received from longitude %.2lf", fromlon ); X bw_error( bw_ebuf ); */ X return BW_ERROR; X } X if ( ( tolon < map_pos[ pos ][ 0 ] ) || ( tolon > map_pos[ pos ][ 2 ] )) X { X /* sprintf( bw_ebuf, "dr_line received to longitude %.2lf", tolon ); X bw_error( bw_ebuf ); */ X return BW_ERROR; X } X #ifdef OLD_DEBUG X sprintf( bw_ebuf, "DEBUG from x = %.2lf, from y = %.2lf, to x = %.2lf, to y = %.2lf, color = %d, style = %d,", X fromlon, X fromlat, X tolon, X tolat, X color, style ); X bw_debug( bw_ebuf ); #endif X X x1 = (( fromlon - (double) ( map_pos[ pos ][ 0 ] ) ) X * ( (double) dr_xsize / ( map_pos[ pos ][ 2 ] - (double) map_pos[ pos ][ 0 ] ) )); X x2 = (( tolon - (double) ( map_pos[ pos ][ 0 ] ) ) X * ( (double) dr_xsize / ( map_pos[ pos ][ 2 ] - (double) map_pos[ pos ][ 0 ] ) )); X X if ( abs( x1 - x2 ) > ( ( dr_xsize / 2 ) + 3 ) ) X { #ifdef OLD_DEBUG X sprintf( sfs_tbuf, "DEBUG: dr_line() failed: x1 = %d, x2 = %d", X x1, x2 ); X bw_debug( sfs_tbuf ); X sprintf( sfs_tbuf, "DEBUG: dr_line() #2: abs() = %d, dr_xsize = %d, dr_xsize / 3 = %d", X abs( x1 - x2), dr_xsize, (dr_xsize / 3) ); X bw_debug( sfs_tbuf ); #endif X return; X } X X y1 = (( fromlat - (double) ( map_pos[ pos ][ 1 ] )) X * ( (double) dr_ysize / ( map_pos[ pos ][ 3 ] - (double) map_pos[ pos ][ 1 ] ) )); X y2 = (( tolat - (double) ( map_pos[ pos ][ 1 ] )) X * ( (double) dr_ysize / ( map_pos[ pos ][ 3 ] - (double) map_pos[ pos ][ 1 ] ) )); X X if ( abs( y1 - y2 ) > ( ( dr_ysize / 2 ) + 3 ) ) X { #ifdef OLD_DEBUG X sprintf( sfs_tbuf, "dr_line() failed: y1 = %d, y2 = %d", X y1, y2 ); X bw_debug( sfs_tbuf ); #endif X return; X } X #ifdef OLD_DEBUG X sprintf( sfs_tbuf, "DEBUG x1 = %d, y1 = %d, x2 = %d, y2 = %d, color = %d, style = %d,", X dr_mapedge + x1, X dr_mapbase + y1, X dr_mapedge + x2, X dr_mapbase + y2, X color, style ); X bw_debug( sfs_tbuf ); #endif X X gr_line( GR_PRIMARY, X dr_mapedge + x1, X dr_mapbase + y1, X dr_mapedge + x2, X dr_mapbase + y2, X color, style ); X } X SHAR_EOF chmod 0644 sfs/map/map_dr.c || echo 'restore of sfs/map/map_dr.c failed' Wc_c="`wc -c < 'sfs/map/map_dr.c'`" test 9366 -eq "$Wc_c" || echo 'sfs/map/map_dr.c: original size 9366, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/map/test.spd ============== if test -f 'sfs/map/test.spd' -a X"$1" != X"-c"; then echo 'x - skipping sfs/map/test.spd (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/map/test.spd (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/test.spd' && ; test.spd ; ; test (blank) SPD map for SFS MAP utility ; 1001 0.0 0.0 0.0 SHAR_EOF chmod 0644 sfs/map/test.spd || echo 'restore of sfs/map/test.spd failed' Wc_c="`wc -c < 'sfs/map/test.spd'`" test 75 -eq "$Wc_c" || echo 'sfs/map/test.spd: original size 75, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/buildsfs.bat ============== if test ! -d 'sfs/sfs'; then echo 'x - creating directory sfs/sfs' mkdir 'sfs/sfs' fi if test -f 'sfs/sfs/buildsfs.bat' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/buildsfs.bat (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/buildsfs.bat (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/buildsfs.bat' && @echo off cls echo BUILD SPACE FLIGHT SIMULATOR echo ---------------------------- echo This Script will lead you through the process of building echo the Space Flight Simulator on a PC-compatible microcomputer echo utilizing the Microsoft QuickC (tm) compiler. The script echo presupposes that you have already installed all of the program echo and source code files in the appropriate subdirectories (see echo the sfs manual and the README file supplied with the source echo code), and that you have built the Bywater Graphical User echo Interface). If you do not have Microsoft QuickC, this script is echo useless, and you should exit now by hitting CONTROL-C. pause echo BUILD SFS PROGRAM LOADER echo ------------------------ copy ..\as\as.h ..\..\include nmake -f sfs.mak echo BUILD SFS ORBITAL MODELING MODULE echo --------------------------------- nmake -f sfsm_n.mak echo BUILD SFS ORBITAL SIMULATION MODULE echo ----------------------------------- nmake -f sfsx_n.mak echo Copying program files to sfs\bin area... copy sfs.exe ..\bin copy sfsm.exe ..\bin\sfsm.app copy sfsx.exe ..\bin\sfsx.app echo PROGRAM IS NOW COMPLETE echo ----------------------- echo The script will now proceed to execute the Space Flight Simulator. echo If you do not wish to do so, exit now by hitting CONTROL-C. pause cd ..\bin sfs SHAR_EOF chmod 0644 sfs/sfs/buildsfs.bat || echo 'restore of sfs/sfs/buildsfs.bat failed' Wc_c="`wc -c < 'sfs/sfs/buildsfs.bat'`" test 1320 -eq "$Wc_c" || echo 'sfs/sfs/buildsfs.bat: original size 1320, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/buildsfs.sh ============== if test -f 'sfs/sfs/buildsfs.sh' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/buildsfs.sh (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/buildsfs.sh (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/buildsfs.sh' && # buildsfs.sh build script for Space Flight Simulator, ver. 1.00 # # set the following to your base directory for SFS sources, # i.e., the directory from which sfs and io are both subdirectories # clear echo Build Space Flight Simulator ver. 1.00 echo -------------------------------------- echo echo This script should be placed in the top directory for SFS echo sources, i.e., in the directory from which both io and echo sfs are subdirectories. It allows SFS to be built on the echo AT\&T Unix PC utilizing either TAM or MGR, or on a echo computer using the X Windows system. echo echo Select system to build: echo echo " 1 AT&T Unix PC using TAM" echo " 2 AT&T Unix PC using MGR" echo " 3 X Windows" echo echo "Press a key and RETURN: " echo read NUMBER echo X if [ "$NUMBER" -eq 1 ] X then X echo "Building for AT&T Unix PC using TAM" X cp makefile.tam makefile X else if [ "$NUMBER" -eq 2 ] X then X echo "Building for AT&T Unix PC using MGR" X cp makefile.mgr makefile X else if [ "$NUMBER" -eq 3 ] X then X echo "Building for X Windows" X cp makefile.x makefile X X else X echo Choice not supported. X exit 1 X X fi X fi fi X echo copying as header... cp ../as/as.h ../../include echo copying bitmaps for runtime modules cp ../../io/ui/*.pbm ../bin X echo echo echo Building SFS programs... make all X echo echo Program is complete. X # # end of buildsfs.sh SHAR_EOF chmod 0644 sfs/sfs/buildsfs.sh || echo 'restore of sfs/sfs/buildsfs.sh failed' Wc_c="`wc -c < 'sfs/sfs/buildsfs.sh'`" test 1455 -eq "$Wc_c" || echo 'sfs/sfs/buildsfs.sh: original size 1455, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/cleansfs.bat ============== if test -f 'sfs/sfs/cleansfs.bat' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/cleansfs.bat (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/cleansfs.bat (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/cleansfs.bat' && @echo off rem ------------------------------------------------------------ rem File cleansfs.bat - clean up SFS directories rem ------------------------------------------------------------ erase ..\bin\*.fon erase ..\as\*.obj erase ..\as\*.crf erase ..\as\*.exe erase ..\as\*.ini erase ..\sfs\*.obj erase ..\sfs\*.crf erase ..\sfs\*.exe erase ..\sfs\*.ini erase ..\map\*.obj erase ..\map\*.exe erase ..\map\*.crf erase ..\map\*.ini erase ..\map\*.fon erase ..\bin\*.exe erase ..\bin\*.app SHAR_EOF chmod 0644 sfs/sfs/cleansfs.bat || echo 'restore of sfs/sfs/cleansfs.bat failed' Wc_c="`wc -c < 'sfs/sfs/cleansfs.bat'`" test 489 -eq "$Wc_c" || echo 'sfs/sfs/cleansfs.bat: original size 489, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/cleansfs.sh ============== if test -f 'sfs/sfs/cleansfs.sh' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/cleansfs.sh (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/cleansfs.sh (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/cleansfs.sh' && # clean.sh clean up SFS directories # # set the following to your base directory for SFS sources, # i.e., the directory from which sfs and io are both subdirectories # # X rm makefile rm *.o rm ../bin/*.app rm ../bin/sfs rm ../bin/*.pbm rm ../../include/as.h # # end of clean.sh X SHAR_EOF chmod 0644 sfs/sfs/cleansfs.sh || echo 'restore of sfs/sfs/cleansfs.sh failed' Wc_c="`wc -c < 'sfs/sfs/cleansfs.sh'`" test 279 -eq "$Wc_c" || echo 'sfs/sfs/cleansfs.sh: original size 279, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/makefile.mgr ============== if test -f 'sfs/sfs/makefile.mgr' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/makefile.mgr (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/makefile.mgr (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.mgr' && #--------------------------------------------------------------- # # Unix Makefile for Space Flight Simulator # # AT&T Unix PC (tm) using MGR (tm) interface # #--------------------------------------------------------------- X #--------------------------------------------------------------- # Flags for all modules X CFLAGS= -DDEBUG -O -I../../include X #--------------------------------------------------------------- # user interface and astronomy object files X LIBS= ../../lib/ui_boxes.o ../../lib/ui_dial.o \ X ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \ X ../../lib/ui_gets.o \ X ../../lib/gr_mgr.o \ X ../../lib/dr_sysv.o ../../lib/kb_7300.o\ X ../as/as_orbit.o ../as/as_focus.o ../as/as_vpt.o \ X ../as/as_spj.o X #--------------------------------------------------------------- # Common object files X COMM= sfs_pr.o sfs_pe.o X #--------------------------------------------------------------- # Modeling module object files X SFSM= sfsm.o sfsm_om.o X #--------------------------------------------------------------- # Simulation module object files X SFSX= sfsx.o sfsx_cp.o \ X sfsx_sp.o sfsx_var.o \ X sfs_ft.o sfs_gt.o \ X sfs_di.o sfs_vi.o X #--------------------------------------------------------------- # Build all modules X all: sfs sfsm sfsx X #--------------------------------------------------------------- # Build the program loader X sfs: sfs.o X $(CC) -O sfs.o -o sfs X mv sfs ../bin X #--------------------------------------------------------------- # Build the modeling module X sfsm: $(SFSM) $(COMM) X $(CC) $(SFSM) $(COMM) $(LIBS)\ X -lmgr -lm -o sfsm.app X mv sfsm.app ../bin X #--------------------------------------------------------------- # Build the simulation module X sfsx: $(SFSX) $(COMM) X $(CC) $(SFSX) $(COMM) $(LIBS)\ X -lmgr -lm -o sfsx.app X mv sfsx.app ../bin X #--------------------------------------------------------------- # End of makefile.mgr #--------------------------------------------------------------- SHAR_EOF chmod 0644 sfs/sfs/makefile.mgr || echo 'restore of sfs/sfs/makefile.mgr failed' Wc_c="`wc -c < 'sfs/sfs/makefile.mgr'`" test 2007 -eq "$Wc_c" || echo 'sfs/sfs/makefile.mgr: original size 2007, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/makefile.tam ============== if test -f 'sfs/sfs/makefile.tam' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/makefile.tam (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/makefile.tam (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.tam' && #--------------------------------------------------------------- # # Unix Makefile for Space Flight Simulator # # AT&T Unix PC (tm) using TAM library # #--------------------------------------------------------------- X #--------------------------------------------------------------- # Flags for all modules X CFLAGS= -DDEBUG -O -I../../include X #--------------------------------------------------------------- # user interface and astronomy object files X LIBS= ../../lib/ui_boxes.o ../../lib/ui_dial.o \ X ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \ X ../../lib/ui_gets.o \ X ../../lib/gr_tam.o ../../lib/gr_def.o\ X ../../lib/dr_sysv.o ../../lib/kb_tam.o\ X ../as/as_orbit.o ../as/as_focus.o ../as/as_vpt.o \ X ../as/as_spj.o X #--------------------------------------------------------------- # Common object files X COMM= sfs_pr.o sfs_pe.o X #--------------------------------------------------------------- # Modeling module object files X SFSM= sfsm.o sfsm_om.o X #--------------------------------------------------------------- # Simulation module object files X SFSX= sfsx.o sfsx_cp.o \ X sfsx_sp.o sfsx_var.o \ X sfs_ft.o sfs_gt.o \ X sfs_di.o sfs_vi.o X #--------------------------------------------------------------- # Build all modules X all: sfs sfsm sfsx X #--------------------------------------------------------------- # Build the program loader X sfs: sfs.o X $(CC) -O sfs.o -o sfs X mv sfs ../bin X #--------------------------------------------------------------- # Build the modeling module X sfsm: $(SFSM) $(COMM) X $(CC) $(SFSM) $(COMM) $(LIBS)\ X -ltam -ltermcap -lm -o sfsm.app X mv sfsm.app ../bin X #--------------------------------------------------------------- # Build the simulation module X sfsx: $(SFSX) $(COMM) X $(CC) $(SFSX) $(COMM) $(LIBS)\ X -ltam -ltermcap -lm -o sfsx.app X mv sfsx.app ../bin X #--------------------------------------------------------------- # End of makefile.tam #--------------------------------------------------------------- SHAR_EOF chmod 0644 sfs/sfs/makefile.tam || echo 'restore of sfs/sfs/makefile.tam failed' Wc_c="`wc -c < 'sfs/sfs/makefile.tam'`" test 2037 -eq "$Wc_c" || echo 'sfs/sfs/makefile.tam: original size 2037, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/makefile.x ============== if test -f 'sfs/sfs/makefile.x' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/makefile.x (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/makefile.x (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.x' && #--------------------------------------------------------------- # # Unix Makefile for Space Flight Simulator # # X11 Implementation # #--------------------------------------------------------------- X #--------------------------------------------------------------- # Flags for all modules X CFLAGS= -DDEBUG -O -I../../include X #--------------------------------------------------------------- # user interface and astronomy object files X LIBS= ../../lib/ui_boxes.o ../../lib/ui_dial.o \ X ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \ X ../../lib/ui_gets.o ../../lib/ui_pbm.o \ X ../../lib/gr_x.o \ X ../../lib/dr_unix.o ../../lib/kb_x.o X AST= as_orbit.o as_focus.o as_vpt.o \ X as_spj.o X #--------------------------------------------------------------- # Common object files X COMM= sfs_pr.o sfs_pe.o X #--------------------------------------------------------------- # Modeling module object files X SFSM= sfsm.o sfsm_om.o X #--------------------------------------------------------------- # Simulation module object files X SFSX= sfsx.o sfsx_cp.o \ X sfsx_sp.o sfsx_var.o \ X sfs_ft.o sfs_gt.o \ X sfs_di.o sfs_vi.o X #--------------------------------------------------------------- # Build all modules X all: sfs sfsm sfsx X #--------------------------------------------------------------- # Build the program loader X sfs: sfs.o X $(CC) -O sfs.o -o sfs X mv sfs ../bin X #--------------------------------------------------------------- # Build the modeling module X sfsm: $(SFSM) $(COMM) $(AST) X $(CC) $(SFSM) $(COMM) $(LIBS) $(AST) \ X -lX11 -lm -o sfsm.app X mv sfsm.app ../bin X #--------------------------------------------------------------- # Build the simulation module X sfsx: $(SFSX) $(COMM) $(AST) X $(CC) $(SFSX) $(COMM) $(LIBS) $(AST) \ X -lX11 -lm -o sfsx.app X mv sfsx.app ../bin X #-------------------------------------------------------------- # astronomical subroutines dependencies X as_orbit.o: X $(CC) $(CFLAGS) -c ../as/as_orbit.c X as_focus.o: X $(CC) $(CFLAGS) -c ../as/as_focus.c X as_vpt.o: X $(CC) $(CFLAGS) -c ../as/as_vpt.c X as_spj.o: X $(CC) $(CFLAGS) -c ../as/as_spj.c X #--------------------------------------------------------------- # End of makefile.x #--------------------------------------------------------------- SHAR_EOF chmod 0644 sfs/sfs/makefile.x || echo 'restore of sfs/sfs/makefile.x failed' Wc_c="`wc -c < 'sfs/sfs/makefile.x'`" test 2308 -eq "$Wc_c" || echo 'sfs/sfs/makefile.x: original size 2308, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/sfs.c ============== if test -f 'sfs/sfs/sfs.c' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/sfs.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/sfs.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfs.c' && /*************************************************************** X X sfs.c Space Flight Simulator X Loader Program X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ***************************************************************/ X #include "stdio.h" #include "string.h" #ifdef __STDC__ #include "process.h" #include "stdlib.h" #endif #include "ctype.h" X #include "as.h" #include "sfs.h" X #ifndef __STDC__ #define size_t int #endif X /* #define SPAWN */ X #define PROGBUFSIZE 64 X char sfs_program[ PROGBUFSIZE ]; char sfs_tbuf[ 128 ]; X #ifdef SPAWN char arguments[ 5 ][ 64 ]; #endif X main( argc, argv ) X int argc; X char **argv; X { X FILE *data; X register int y, t; X int n; X X strcpy( sfs_program, SFS_DEFAULTPROG ); X if ( argc > 1 ) X { #ifdef OLD_DEBUG X fprintf( stderr, "Argument <%s>\n", argv[ 1 ] ); X getchar(); #endif X strcpy( sfs_program, argv[ 1 ] ); X } X #ifdef SPAWN X y = spawnl( P_WAIT, SFSCH_MODEL, SFSCH_MODEL, sfs_program, NULL ); #else X sprintf ( sfs_tbuf, "%s %s ", SFSCH_MODEL, sfs_program ); #ifdef OLD_DEBUG X fprintf( stderr, "SFS DEBUG: Ready to execute <%s> \n", sfs_tbuf ); X getchar(); #endif X y = system( sfs_tbuf ); #endif X #ifdef OLD_DEBUG X fprintf( stderr, "y = %d \n", y ); X getchar(); #endif X X if ( y == -1 ) X { X printf( SFS_LINKERR ); X perror( ERR_LTITLE ); X return; X } X X while( y != -1 ) X { X if ( ( data = fopen( SFS_CHAINFN, "r" ) ) != NULL ) X { X fgets( sfs_program, PROGBUFSIZE, data ); X fclose( data ); X #ifdef OLD_DEBUG X fprintf( stderr, "DEBUG: read program <%s>\n", sfs_program ); X getchar(); #endif X X if ( strncmp( sfs_program, SFS_EXITARG, (size_t) 4 ) == 0 ) X { X unlink( SFS_CHAINFN ); X return; X } X } X else X { X fprintf( stderr, SFS_CHERR, sfs_program ); X return -1; X } X #ifdef SPAWN X n = sfs_split( sfs_program ); X #ifdef OLD_DEBUG X fprintf( stderr, "sfs_split() returned %d arguments\n", n ); #endif X X switch( n ) X { X case 1: #ifdef OLD_DEBUG X fprintf( stderr, " <%s> \n", arguments[ 0 ] ); X getchar(); #endif X y = spawnl( P_WAIT, arguments[ 0 ], X arguments[ 0 ], NULL ); X break; X case 2: #ifdef OLD_DEBUG X fprintf( stderr, " <%s> <%s> \n", arguments[ 0 ], X arguments[ 1 ] ); X getchar(); #endif X y = spawnl( P_WAIT, arguments[ 0 ], arguments[ 0 ], X arguments[ 1 ], NULL ); X break; X case 3: #ifdef OLD_DEBUG X fprintf( stderr, " <%s> <%s> <%s> \n", arguments[ 0 ], X arguments[ 1 ], arguments[ 2 ] ); X getchar(); #endif X y = spawnl( P_WAIT, arguments[ 0 ], X arguments[ 0 ], arguments[ 1 ], X arguments[ 2 ], NULL ); X break; X X } #else #ifdef OLD_DEBUG X fprintf( stderr, " SFS: Ready to execute <%s> \n", sfs_program ); X getchar(); #endif X y = system( sfs_program ); #endif X } X X perror( ERR_TTITLE ); X } X #ifdef SPAWN sfs_split( s ) X char *s; X { X int c, d; X char *p; X X /* eat up leading whitespace */ X X p = s; X while ( isspace ( *p )) X { X ++p; X } X X /* now read each argument until end of the string */ X X c = d = 0; X while ( *p != 0 ) X { X X /* read characters into the arguments buffer */ X X while( ( isspace( *p ) == 0 ) && ( *p != 0 )) X { X arguments[ c ][ d ] = *p; X ++d; X ++p; X arguments[ c ][ d ] = 0; X } X X /* reset d counter and advance to next word */ X X d = 0; X ++c; X X /* eat up trailing whitespace */ X X while( isspace( *p )) X { X ++p; X } X #ifdef OLD_DEBUG X printf( "DEBUG: c is %d \n", c ); #endif X X } X #ifdef OLD_DEBUG X printf( "DEBUG: returning %d\n", c ); #endif X return c; X X } X #endif X SHAR_EOF chmod 0644 sfs/sfs/sfs.c || echo 'restore of sfs/sfs/sfs.c failed' Wc_c="`wc -c < 'sfs/sfs/sfs.c'`" test 4685 -eq "$Wc_c" || echo 'sfs/sfs/sfs.c: original size 4685, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= sfs/sfs/sfs.h ============== if test -f 'sfs/sfs/sfs.h' -a X"$1" != X"-c"; then echo 'x - skipping sfs/sfs/sfs.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting sfs/sfs/sfs.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfs.h' && /*************************************************************** X X sfs.h Space Flight Simulator X General Header X X Copyright (c) 1991, Ted A. Campbell X X Bywater Software X P. O. Box 4023 X Duke Station X Durham, NC 27706 X X email: tcamp@hercules.acpub.duke.edu X X Copyright and Permissions Information: X X All U.S. and international copyrights are claimed by the X author. The author grants permission to use this code X and software based on it under the following conditions: X (a) in general, the code and software based upon it may be X used by individuals and by non-profit organizations; (b) it X may also be utilized by governmental agencies in any country, X with the exception of military agencies; (c) the code and/or X software based upon it may not be sold for a profit without X an explicit and specific permission from the author, except X that a minimal fee may be charged for media on which it is X copied, and for copying and handling; (d) the code must be X distributed in the form in which it has been released by the X author; and (e) the code and software based upon it may not X be used for illegal activities. X ***************************************************************/ X /*** Version number -- for all modules */ X #define VERSION "1.01" X /*** Definitions for all sfs modules */ X #ifndef CR #define CR 0x0d #endif X #ifndef LF #define LF 0x0a #endif X #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif X #define FAR_SEGMENT #define FMALLOC malloc X #define FT_POINTS 64 /* Points in forward track buffer */ #define ORBITS (16) /* Number of orbits tracked */ #define GT_POINTS 512 /* Size of ground track buffer */ #define PE_POINTS 64 /* Size of Perspective buffer */ #define OR_COLORS 6 /* Colors for orbits */ #define HORDEGS 30.0 /* Horizontal degrees in window X for visual display */ #define DEFAULTFD "earth.fd" /* default focal data file */ #define DEFAULTSD "null.spd" /* default surface data point file */ #define DEFAULTORB "orb.spd" /* default orb point file */ #define DEFAULTGRID "latlon.spd" /* default grid point file */ #define SFS_DEFAULTPROG "default.sfs" /* default program file */ #define SFS_CHAINFN "chain" /* name for chian file */ #define SFS_EXITARG "exit" /* argument denotes exit from X program */ #define SFS_CONTARG "cont" /* argument denotes continuation X (do not show logo) */ #define SFS_FILESIZE 36 /* size for filename buffers */ X /*** Definitions of names for chain files */ X #define SFSCH_EXIT "exit" /* exit from SFS */ #define SFSCH_SIMUL "sfsx.app" /* chain to simulation module */ #define SFSCH_MODEL "sfsm.app" /* chain to modeling module */ #define SFSCH_ATLAS "sfsa.app" /* chain to atlas module */ X /*** Definitions of Display Types */ X #define SFSD_VISUAL 0 /* visual simulation display */ #define SFSD_PERSP 1 /* distant perspective display */ #define SFSD_GROUND 2 /* ground track display */ X /*** Definitions of Visual Simulation Elements */ X #define VI_GRIDFRONT 1 /* show front of grid */ #define VI_GRIDBACK 2 /* show back of grid */ #define VI_SURFRONT 4 /* show front of surface features */ #define VI_SURBACK 8 /* show back of surface features */ #define VI_ORBOUTLINE 16 /* show outline of orb */ #define VI_ORBBLANK 32 /* blank the orb before drawing */ #define VI_POINTS 64 /* show points */ #define VI_PTITLES 128 /* show point titles */ #define VI_STITLE 256 /* show screen title */ #define VI_CROSSH 512 /* show crosshair */ X /*** Alignments for Visual Simulation DIsplay */ X #define AL_HORIZON 0 #define AL_CENTER 1 X /*************************************************************** X X language-specific definitions X X English is taken as a default, and if SFS_TITLE X has not been defined, the English definitions will be X utilized. To translate into other languages, we suggest X that the following section be copied, a language name X defined as one, and then each of the definitions rendered X into the language. Example: X X ;#define LATIN 1 X ; X ; X ;#if LATIN X ;#define SFS_TITLE " Astronautica Simulanda " X ;......etc. X ;#endif X X SFS_TITLE will then be defined, and the English language X tags will not be called. X ***************************************************************/ X #ifndef SFS_TITLE #define SFS_TITLE "Space Flight Simulator" #define VERABB "ver." #define SFS_LINKERR "SFS failed to link to the Main Module.\n" #define ERR_LTITLE "Link error" #define SFS_CHERR "SFS failed to chain to %s\n" #define ERR_TTITLE "SFS termination error" #define DI_MEMERR "Cannot allocate memory for display initialization" #define DI_DSMEMERR "Cannot allocate memory for display structures" #define DI_DMEMERR "Cannot allocate memory for display initialization" #define VIS_TITLE "Visual: %s from %s (Orbit %d)" #define PER_TITLE "Perspective: %s orbits" #define GTR_TITLE "Ground Track: %s orbits" #define FT_NOTICE "Initializing forward track for orbit %d" #define FT_CALC "Calculating forward track for orbit %d" #define GT_DRAW "Drawing ground track" #define GT_WTITLE " Ground Track: %s orbit(s)" #define GTERR_NODATA "gt_track(): data is not ready." #define PE_CALC "Calculating perspective points for orbit %d" #define PE_DRAW "Drawing distant perspective" #define PE_WTITLE " %s from %.0lf km; point = %ld seconds " #define PRERR_OPEN "Cannot open program file <%s> " #define PR_NOTICE "Interpreting program file %s; %s " #define PRERR_PRI "Periapsis must be > 0 " #define PRERR_APO "Apoapsis must be > 0 and <= periapsis" #define PRERR_INC "Inclination must be > %.1lf and < %.1lf" #define PRERR_LAN "Long. of asc. node must be > %.1lf and < %.1lf" #define PRERR_ARP "Argument of periapsis must be >= %.1lf and < %.1lf" #define PRMEMERR_NAME "Cannot allocate storage for orbit name." #define PRERR_TF "Time factor must be > 0" #define PRERR_UI "Update interval must be > 0 " #define PRERR_TL "Trig level must be 1 or 2" #define PRERR_INS "Insertion must be > 0" #define PRERR_UNKNOWN "Unknown command %s " #define PRMEMERR_SORBIT "Cannot allocate storage for sfs orbit." #define PRMEMERR_AORBIT "Cannot allocate storage for as orbit." #define PRERR_WRITE "Cannot open program file %s for writing." #define PRMEMERR_FOCUS "Cannot allocate storage for as focus." #define VI_DRAW "Drawing visual simulation" #define VI_WTITLE " Visual Simulation: %s from %s " #define VI_POS "Position" #define VI_ORBIT "Orbit" #define VI_LAT "LAT" #define VI_LON "LON" #define VI_ALT "ALT" #define TF_TITLE "Set Time Factor" #define TF_LEGEND "The time factor is the ratio between computed time and real time. A time factor of 1 is equivalent to real-time. Enter the time factor as a whole number." #define TF_PROMPT "Time Factor: " #define UI_TITLE "Set Screen Update Interval" #define UI_LEGEND "The screen update interval determines the amount of time (in seconds) between screen updates. Enter the screen update interval in seconds." #define UI_PROMPT "Update Interval: " #define TPL_TITLE "Set Trig Precision Level" #define TPL_LEGEND "The Trig Precision Level specifies the accuracy of trig calculations: 1 = fast, 2 = accurate. Enter 1 or 2. " #define TPL_PROMPT "Precision Level: " #define MINERR "ERROR in entry: Value entered must be more than" #define MAXERR "ERROR in entry: Value entered must be less than" #define PTA "Please try again" #define SFS_TOGGLE "Toggle" #define PR_PARAMS "parameters for orbit" #define PR_ENDOF "end of file" #define PR_CREATED "created" #endif X /*** Structure definitions for all sfs modules */ X struct ft_pt /* forward track point structure */ X { X double latitude; /* latitude of the point */ X double longitude; /* longitude of the point */ X double altitude; /* altitude of the point */ X }; X struct sfs_orbit X { X struct as_orbit *aorbit; /* as orbit structure */ X char *name; /* name of this orbit */ X struct ft_pt ft_buffer[ FT_POINTS ]; /* Buffer for forward track */ X int ft_bufstart; /* Start of forward track buffer */ X int ft_bufpos; /* End of forward track buffer */ X long ft_inc; /* Time increment for f.t. */ X double gt_buffer[ GT_POINTS ][ 2 ]; /* Ground track buffer */ X int gt_bufstart; /* Start of ground track buffer */ X int gt_bufpos; /* End of ground track buffer */ X struct ft_pt pe_buffer[ PE_POINTS ]; /* Perspective data buffer */ X long pe_inc; /* Time increment for perspective */ X long ft_t; X long last_time; X char *orbfile[ SFS_FILESIZE ]; /* orb filename */ X char *gridfile[ SFS_FILESIZE ]; /* grid filename */ X char *surfile[ SFS_FILESIZE ]; /* surface feature filename */ #ifdef USEPOINTS X char *pdfile[ SFS_FILESIZE ]; /* point data filename */ #endif X struct spj_pt o_start; /* start orb structure */ X struct spj_pt o_end; /* end orb structure */ X struct spj_pt g_start; /* start grid structure */ X struct spj_pt g_end; /* end grid structure */ X struct spj_pt s_start; /* start surface structure */ X struct spj_pt s_end; /* end surface structure */ #ifdef USEPOINTS X struct spj_pt p_start; /* start point structure */ X struct spj_pt p_end; /* end point structure */ #endif X double ssp_lat; /* latitude return from or_ssp() */ X double ssp_lon; /* longitude return from or_ssp() */ X long ssp_r; /* orbit distance return from or_ssp() */ X long ssp_n; /* orbit number return from or_ssp() */ X double nssp_lat; /* next latitude return from or_ssp() */ X double nssp_lon; /* next longitude return from or_ssp() */ X long nssp_r; /* next orbit distance return from or_ssp() */ X long nssp_n; /* next orbit number return from or_ssp() */ X double ssp_rot; /* rotation for orbit */ X }; X /*** Structure for displays */ X struct sfs_display X { X int type; /* type of display: SFSD_xxx */ X int elements; /* display elements */ X int orbit; /* orbit number for visual */ X struct as_focus *focus; /* focus for perspective or ground track */ X int gt_xsize; /* Size of ground track map, x */ X int gt_ysize; /* Size of ground track map, y */ X int gt_mapbase; /* Bottom of gt map */ X int gt_mapedge; /* Left edge of groundtrack map */ X }; X /*** External declarations for all sfs modules */ X extern double vi_rotate(); extern long sfs_inc; extern long sfs_insertion; extern long sfs_tfactor; X /*** Colors */ X extern int cl_mback; /* Main background color */ extern int cl_mfore; /* Main foreground color */ extern int cl_marker; /* Color for prompt markers */ extern int cl_grid; /* Color for planetary grid */ extern int cl_surface; /* Color for planetary surface */ extern int cl_orbits[ OR_COLORS ]; /* Colors for different orbits */ SHAR_EOF true || echo 'restore of sfs/sfs/sfs.h failed' fi echo 'End of part 17' echo 'File sfs/sfs/sfs.h is continued in part 18' echo 18 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.